<template>
  <div id="center">
    <div class="up">
      <div
        v-for="item in titleItem"
        :key="item.title"
        class="bg-color-black item"
      >
        <p class="ml-3 colorBlue fw-b fs-xl">{{ item.title }}</p>
        <div>
          <dv-digital-flop
            class="dv-dig-flop ml-1 mt-2 pl-3"
            :config="item.number"
          />
        </div>
      </div>
    </div>
    <div class="down">
      <div class="rolling bg-color-black">
        <div class="mixBar">
          <CenterChart />
        </div>
      </div>
    </div>
  </div>
</template>

<script>
import CenterChart from '@/components/echart/center/centerChart'

export default {
  components: {
    CenterChart
  },
  data() {
    return {
      titleItem: [
        {
          title: '当日产量总成品汇总',
          number: {
            number: [12612],
            toFixed: 0,
            textAlign: 'left',
            content: '{nt}',
            style: {
              fontSize: 26
            }
          }
        },
        {
          title: '当日产量一级品汇总',
          number: {
            number: [11401],
            toFixed: 0,
            textAlign: 'left',
            content: '{nt}',
            style: {
              fontSize: 26
            }
          }
        },
        {
          title: '当日产量合格品汇总',
          number: {
            number: [12612 - 11901],
            toFixed: 0,
            textAlign: 'left',
            content: '{nt}',
            style: {
              fontSize: 26
            }
          }
        },
        {
          title: '当日产量协议品汇总',
          number: {
            number: [0],
            toFixed: 0,
            textAlign: 'left',
            content: '{nt}',
            style: {
              fontSize: 26
            }
          }
        },
        {
          title: '当日产量总损失汇总',
          number: {
            number: [72],
            toFixed: 0,
            textAlign: 'left',
            content: '{nt}',
            style: {
              fontSize: 26
            }
          }
        },
        {
          title: '当日产量成品率',
          number: {
            number: [91.4],
            toFixed: 1,
            textAlign: 'left',
            content: '{nt}',
            style: {
              fontSize: 26
            }
          }
        }
      ],
      ranking: {
        data: [
          {
            name: '2023-11-07',
            value: 8089.4
          },
          {
            name: '2023-11-06',
            value: 8177.1
          },
          {
            name: '2023-11-05',
            value: 8299.5
          },
          {
            name: '2023-11-04',
            value: 8075.1
          }
        ],
        carousel: 'single',
        unit: ' '
      },
      water: {
        data: [20, 98],
        shape: 'roundRect',
        formatter: '{value}%',
        waveNum: 1
      },
      // 通过率和达标率的组件复用数据
      rate: [
        {
          id: 'centerRate1',
          tips: 98.02,
          colorData: {
            textStyle: '#3fc0fb',
            series: {
              color: ['#00bcd44a', 'transparent'],
              dataColor: {
                normal: '#03a9f4',
                shadowColor: '#97e2f5'
              }
            }
          }
        },
        {
          id: 'centerRate2',
          tips: 96.91,
          colorData: {
            textStyle: '#67e0e3',
            series: {
              color: ['#faf3a378', 'transparent'],
              dataColor: {
                normal: '#ff9800',
                shadowColor: '#fcebad'
              }
            }
          }
        }
      ]
    }
  }
}
</script>

<style lang="scss" scoped>
#center {
  display: flex;
  flex-direction: column;
  .up {
    width: 100%;
    display: flex;
    flex-wrap: wrap;
    justify-content: space-around;
    .item {
      border-radius: 6px;
      padding-top: 8px;
      margin-top: 8px;
      width: 32%;
      height: 75px;
      .dv-dig-flop {
        width: 150px;
        height: 30px;
      }
    }
  }
  .down {
    padding: 6px 4px 0;
    width: 100%;
    display: flex;
    height: 95px;
    justify-content: space-between;
    .bg-color-black {
      border-radius: 5px;
    }
    .rolling {
      padding: 10px;
      width: 100%;
      .mixBar {
        height: 95px;
      }
    }
  }
}
</style>
